package com.ht.medicaltreatment.viewmodel

import com.hjq.http.EasyHttp
import com.hjq.http.listener.OnHttpListener
import com.ht.medicaltreatment.bean.HaoCaiShenQingListBean
import com.ht.medicaltreatment.http.api.HaoCaiShenQingAPI

class HaoCaiShenQingViewModel : BaseViewModel(){
    fun getList(page:String,projectId:String,onResult:(HaoCaiShenQingListBean.DataBean)->Unit){
        EasyHttp.post(this)
            .api(HaoCaiShenQingAPI(page, projectId = projectId))
            .request(object : OnHttpListener<HaoCaiShenQingListBean>{
                override fun onHttpSuccess(result: HaoCaiShenQingListBean) {
                    onResult(result.data)
                }

                override fun onHttpFail(e: Exception) {
                    dismissProgress(e.message?:"")
                }
            })
    }
}
